/*
 * @Descripttion:
 * @LastEditors: xzh
 * @LastEditTime: 2023-09-16 13:40:05
 */
import { createI18n } from "vue-i18n";
//Element语言包
import lang_cn from "element-plus/es/locale/lang/zh-cn";
import lang_tw from "element-plus/es/locale/lang/zh-tw";
import lang_en from "element-plus/es/locale/lang/en";
//自定义语言包
import locale_en from "./language/en.json";
import locale_cn from "./language/zh-cn.json";
import locale_tw from "./language/cht.json";
//vxe-table语言包
import vxeTable_cn from "vxe-table/lib/locale/lang/zh-CN";
import vxeTable_tw from "vxe-table/lib/locale/lang/zh-TW";
import vxeTable_en from "vxe-table/lib/locale/lang/en-US";
import Dile_StoreAction from "@/utils/cache/store";

//注册并引入语言文件
const creatI18n = () =>
  createI18n({
    locale: Dile_StoreAction.getLanguage().current,
    messages: {
      zh: {
        ...locale_cn,
        ...lang_cn,
        ...vxeTable_cn,
      },
      cht: {
        ...locale_tw,
        ...lang_tw,
        ...vxeTable_tw,
      },
      en: {
        ...locale_en,
        ...lang_en,
        ...vxeTable_en,
      },
    },
    silentTranslationWarn: true, // 去除console中黄色报错
    legacy: false,
  });
export default creatI18n;
